﻿<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script src="/static/js/common.js"></script>
    <style>
        .el-dialog__body {
            height: 100% !important;
        }

            .el-dialog__body iframe {
                height: 100% !important;
            }

        .el-dialog.is-fullscreen {
            overflow: hidden !important;
        }

        .el-dialog__wrapper {
            position: absolute !important;
        }
    </style>
</head>

<body>
    <div id="app" v-cloak>
        <el-form label-position="right" ref="form" :inline="true" :model="formInline" class="demo-form-inline"
                 style="margin-bottom: 15px;">
            <el-row>
                <el-col class="head-tool">
                    <div class="new_title fl"><strong><img src="/static/images/icon1.png" />用户管理列表</strong></div>
                    <span>
                        <btn :text="col.btnSelect" linetype="3" @click="onSubmit"></btn>
                        <btn :text="col.btnAdd" linetype="3" v-if="authorize('UserController_SaveAsync')"
                             @click="UserInput('tj')">{{col.btnAdd}}</btn>
                        <btn text="分配岗位" imgsrc="/static/images/general.png" linetype="3"
                             v-if="authorize('UserController_GetUserDuty')" @click="UserInput('fpzw')"></btn>
                        <btn-export-list linetype="3" url="/api/user/Export" :forminline="this.formInline"></btn-export-list>
                        <btn :text="col.btnDelete" linetype="4" v-if="authorize('UserController_DeleteMutiAsync')"
                             @click="onDelete">{{col.btnDelete}}</btn>
                    </span>
                </el-col>
            </el-row>
            <el-row>
                <!--工厂组件-->
                <list-factorys-all v-model="formInline.model.SysUserInfor.WorkCompany"></list-factorys-all>
                <el-col :xs="6" :sm="6" :md="6" :lg="4" :xl="4">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input size="mini">
                                <template slot="prepend">
                                    {{user.sex+mark.m}}
                                </template>
                                <el-select @visible-change="visibleChange" v-model="formInline.model.SysUserInfor.sex" slot="suffix"
                                           :placeholder="user.sex">
                                    <el-option label="请选择" value=""></el-option>
                                    <el-option v-for="item in sex" :label="item.value" :value="item.key"></el-option>
                                </el-select>
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>
                <el-col :xs="6" :sm="6" :md="6" :lg="4" :xl="4">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input v-model="formInline.model.loginName" :placeholder="user.loginName" size="mini">
                                <template slot="prepend">
                                    {{user.loginName+mark.m}}
                                </template>
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>

            </el-row>
        </el-form>
        <el-table stripe ref="table" :data="ListItem.tableData" :row-key="getRowKeys" :height="ListItem.tableHeight" border
                  @selection-change="handleSelectionChange" row-style="height:10px" style="width: 100%;">
            <el-table-column type="selection" style="
    padding-top: 0px;
    padding-bottom: 0px;
" align="center" width="55" :reserve-selection="true" show-overflow-tooltip="true">
            </el-table-column>

            <el-table-column prop="loginName" :label="user.loginName" min-width="100" show-overflow-tooltip="true">
            </el-table-column>
            <el-table-column prop="sysUserInfor.sex" :label="user.sex" min-width="100" show-overflow-tooltip="true">
            </el-table-column>
            <el-table-column prop="name" label="姓名" min-width="100" show-overflow-tooltip="true">
            </el-table-column>
            <el-table-column prop="sysUserInfor.birthday" label="生日" min-width="100" show-overflow-tooltip="true">
            </el-table-column>
            <el-table-column prop="sysUserInfor.telephone" label="联系电话" min-width="100" show-overflow-tooltip="true">
            </el-table-column>
            <el-table-column prop="sysUserInfor.workType" label="从事工种" min-width="100" show-overflow-tooltip="true">
            </el-table-column>
            <el-table-column prop="sysUserInfor.workCompanyText" label="工作地点(工厂)" min-width="120" show-overflow-tooltip="true">
            </el-table-column>
            <el-table-column label="是否为双总" min-width="100" show-overflow-tooltip="true">
                <template slot-scope="scope">
                    {{scope.row.sysUserInfor.isBoth==1?'是':'否'}}
                </template>
            </el-table-column>
            <el-table-column label="是否加入培训计划" min-width="140" show-overflow-tooltip="true">
                <template slot-scope="scope">
                    {{scope.row.sysUserInfor.isTrainPlan==1?'是':'否'}}
                </template>
            </el-table-column>
            <el-table-column label="是否遵守保命条款" min-width="140" show-overflow-tooltip="true">
                <template slot-scope="scope">
                    {{scope.row.sysUserInfor.isClause==1?'是':'否'}}
                </template>
            </el-table-column>
            <el-table-column prop="remarks" :label="user.remarks" min-width="100" show-overflow-tooltip="true">
            </el-table-column>
            <el-table-column prop="lastUpdate" :label="user.lastUpdate" width="110" show-overflow-tooltip="true">
            </el-table-column>
            <el-table-column width="53" v-if="authorize('UserController_SaveAsync')" prop="update"
                             :label="col.btnUpdate" fixed="right">
                <template slot-scope="scope">
                    <button type="button" class="elst-bt-xg" @click=UserInput('xg',scope.row.id)>
                        <i class="el-icon-edit"></i>
                    </button>
                </template>
            </el-table-column>

        </el-table>
        <el-row type="flex" justify="end">
            <el-pagination ref="page" @size-change="handleSizeChange" @current-change="handleCurrentChange"
                           :current-page="ListItem.currentPage" :page-sizes="ListItem.pagesizes" :page-size="ListItem.pagesize"
                           :layout="ListItem.layout" :total="ListItem.total">
            </el-pagination>
        </el-row>
        <el-dialog title="用户信息管理" fullscreen="true" :visible.sync="ListItem.dialogVisible" @close='closeDialog' width="80%" height="100%"
                   top="10vh">
            <iframe ref="iframe" :src="ListItem.InputUrl" style="height:95%;width:100%" frameborder="0"></iframe>
        </el-dialog>
    </div>
    <script type="text/javascript">
        var app = new Vue({
            el: '#app',
            data: {
                pageInitial: {},
                //表单内容
                ListItem: ListItem,
                //获取下拉菜单sex
                sex: [],
                formInline: {
                    model: { loginName: '', SysUserInfor: { sex: '', WorkCompany: null } },
                    offset: 0,
                    limit: 10
                }
            },
            mounted: function () {
                //列表高度自适应
                tablehigh(this);
                this.pageInitial = PageInitial(["001"], [
                    "UserController_GetList",
                    "UserController_SaveAsync",
                    "UserController_DeleteMutiAsync",
                    "UserController_Get",
                    "UserController_GetUserDuty"
                ]);
                var dicDataList = this.pageInitial.dataDicList;
                //获取下拉菜单内容
                this.sex = getDicDataFodDataList(dicDataList, '001');
                this.$nextTick(function () {
                    //初始化数据
                    this.GetPageData(1);
                });
            },
            methods: {
                //解決edge下select bug
                visibleChange: function (isVisible) {
                    visibleChange(isVisible)
                },
                authorize: function (functionCode) { return authorize(this.pageInitial.authorizeList, functionCode); },
                //关闭Dialog 回调
                closeDialog: function () { closeDialog(this); },
                //删除方法
                onDelete: function () { onDelete(this, '/api/User/DeleteMuti'); },
                //列表选择触发
                handleSelectionChange: function (val) { handleSelectionChange(this, val); },
                //Dialog展示
                UserInput: function (val, id) {
                    if (val == 'fpzw') {
                        if (this.ListItem.tableMultipleSelection.length == 0) {
                            showMessage(msg.AtLeastOne, 'error')
                            return;
                        }
                        this.ListItem.InputUrl = "SysUserDutyInput.html?id=" + this.ListItem.tableMultipleSelection[0].id + "&t=" + Date.parse(new Date());
                        this.ListItem.dialogVisible = true;
                    }
                    else {
                        DialogShow(this, val, "SysUserInput.html", id);
                    }
                },
                //获取分页数据
                GetPageData: function (currentIndex) { GetPageData(this, currentIndex, '/api/User/GetList') },
                //查询方法
                onSubmit: function () { onSubmit(this); },
                //pagesize改变 触发方法
                handleSizeChange: function (val) { handleSizeChange(this, val); },
                //跳页触发方法
                handleCurrentChange: function (val) { handleCurrentChange(this, val); },
            }
        });
    </script>
</body>

</html>